<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!--首页-->
      <div id="home">
        <span>首页</span>
        <lk-box brand="百度" :lessons="['VR', 'AR']"></lk-box>
      </div>
      <!--消息-->
      <div id="msg">
        <span>消息</span>
        <lk-box brand="谷歌" :lessons="['CSS', 'HTML']"></lk-box>
      </div>
      <!--我的-->
      <div id="mine">
        <span>我的</span>
        <lk-box brand="撩课" :lessons="['Java', 'Web']"></lk-box>
      </div>
    </div>

    <template id="box">
      <h3>{{brand}}</h3>
      <ul>
        <li v-for="item in lessons">{{item}}</li>
      </ul>
      <hr>
    </template>
    <script src="../js/vue.js"></script>

    <script>
      const box = {
        template: "#box",
        props: ["brand", "lessons"],
      };

      //实例化vue
      const app = Vue.createApp({
        data() {
          return {
            msg1: "哈哈哈",
            lessons: ["php", "mysql", "web", "javascript", "go"],
          };
        },
        components: {
          "lk-box": box,
        },
      }).mount("#app");
    </script>
  </body>
</html>
